home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / VOL_400 / 446_01 / DOC / SPLINES / EX / PROG1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  829 b   |  28 lines

  1. // ********************* File: Prog1.C ***********************
  2. // Demonstration of class KnotVec for representing knot vectors
  3. #include <KnotVec.h>
  4. #include <Vec_real.h>
  5. int main()
  6. {
  7.   Vec(real) vec1(5);
  8.   vec1.fill(1,5);  // the content becomes 1 2 3 4 5
  9.  
  10.   KnotVec knots1;  knots1.redim(5);  knots1=vec1;
  11.   s_o << "The first knot vector is like\n";
  12.   knots1.print(s_o);  s_o << "\n\n";
  13.  
  14.   KnotVec knots2(5);  knots2=knots1;
  15.   s_o << "The second knot vector is like\n";
  16.   knots2.print(s_o);  s_o << "\n\n";
  17.  
  18.   KnotVec knots3(vec1);
  19.   s_o << "The third knot vector is like\n";
  20.   knots3.print(s_o);  s_o << "\n\n";
  21.  
  22.   KnotVec knots4(knots3);  knots4.regulate(4);
  23.   s_o << "The fourth knot vector is like\n";
  24.   knots4.print(s_o);  s_o << "\n";
  25.   if (knots4.kRegular(4)) s_o << "And it is a 4-regular knot vector.\n";
  26.   return 0;
  27. }
  28.